package com.hns.can.service.web;

import com.hns.can.common.web.BaseController;
import com.hns.can.service.entity.BaseDrvChkParamInfoEntity;
import com.hns.can.service.service.SafeBehaviorScoreService;
import com.hns.can.service.vo.SafeBehaviorScoreVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 行为考核评分设置Controller
 * @author:zhangzq
 * @email:
 * @version Revision 2.0.0
 */
@Controller
@RequestMapping("/safeBehaviorScore")
public class SafeBehaviorScoreController extends BaseController {

    @Autowired
    private SafeBehaviorScoreService safeBehaviorScoreService;

    /**
     * 驾驶安全行为评分标准 - 获取该组织机构下的驾驶安全行为评分标准信息，如果没有的话显示为默认的信息
     * @param corpId
     * @param organId
     * @author:zhangzq
     * @email:
     */
    @RequestMapping("/searchSafeBehaviorScoreInfo")
    @ResponseBody
    public Object searchSafeBehaviorScoreInfo(String corpId, String organId) throws Exception {
        Map<String, Object> paraMap = new HashMap<String, Object>();
        paraMap.put("organId", organId);
        paraMap.put("corpId", corpId);
        paraMap.put("qchkCgyCodes", new String[]{"CHK03000"});
        paraMap.put("qtype", "safeBehaviorScore");
        List<BaseDrvChkParamInfoEntity> list = safeBehaviorScoreService.searchSafeBehaviorScoreInfo(paraMap);
        return this.getReturnResult(list);
    }

    /**
     * 行为考核评分设置
     * @param data
     * @author:zhangzq
     * @email:
     */
    @RequestMapping("/uptSafeBehaviorScoreInfo")
    @ResponseBody
    public Object uptSafeBehaviorScoreInfo(SafeBehaviorScoreVo data) throws Exception {
        safeBehaviorScoreService.uptSafeBehaviorScoreInfo(data);
        return this.getReturnMsg("您成功修改该机构的驾驶安全行为评分标准信息。");
    }
}
